﻿//-----------------------------------------------------------------------
// <copyright file="XmlFileProcessorConstants.cs" company="Anurag Chatterjee">
//     Copyright (c) Anurag Chatterjee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace WordsBase
{
    /// <summary>
    /// The constants for xml file processor
    /// </summary>
    public static class XmlFileProcessorConstants
    {
        /// <summary>
        /// The base node identifier
        /// </summary>
        public const string BaseNodeIdentifier = "/Words";

        /// <summary>
        /// The root node identifier
        /// </summary>
        public const string RootNodeIdentifier = "RootWord";

        /// <summary>
        /// The derived word identifier
        /// </summary>
        public const string DerivedWordIdentifier = "DerivedWord";

        /// <summary>
        /// The value attribute name
        /// </summary>
        public const string ValueAttributeName = "Value";

        /// <summary>
        /// Gets the x path query to the root.
        /// </summary>
        /// <value>
        /// The x path query to the root.
        /// </value>
        public static string XPathQueryToRoot
        {
            get
            {
                //// .//RootWord[@Value='birds']/DerivedWord[text() = 'eagle']
                const string XmlPathQuery = ".//" + RootNodeIdentifier + "[@" + ValueAttributeName + "='{0}']";
                return XmlPathQuery;
            }
        }

        /// <summary>
        /// Gets the x path query to derived word.
        /// </summary>
        /// <value>
        /// The x path query to derived word.
        /// </value>
        public static string XPathQueryToDerivedWord
        {
            get
            {
                const string XmlPathQuery = ".//" + RootNodeIdentifier + "[@" + ValueAttributeName + "='{0}']/" + DerivedWordIdentifier + "[text() = '{1}']";
                return XmlPathQuery;
            }
        }
    }
}
